package job.mfp.document_builder;

import java.io.IOException;

import mapred.SimpleJob;
import mapred.config.Compress;
import mapred.config.JobConfig;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.Reducer;
import org.apache.hadoop.mapred.RunningJob;

@SuppressWarnings("unchecked")
public class MFP_DocumentBuilder extends SimpleJob {

    public MFP_DocumentBuilder(String... settings) throws IOException {
        super("Document Builder", settings);
    }

    @Override
    protected Class<? extends Reducer> getCombinerClass() {
        return null;
    }

    @Override
    protected Compress getCompress() {
        return Compress.GZIP;
    }

    @Override
    protected String[] getInputPaths(FileSystem fs) throws IOException {
        return new String[] { "/user/hqs/SegmentedPage/CJK.retrieve" };
    }

    @Override
    protected Class<? extends Mapper> getMapperClass() {
        return MFP_DocumentBuilder_Mapper.class;
    }

    @Override
    protected String getOutputPath(FileSystem fs) throws IOException {
        return "/user/renp/Document_Build/CJK.retrieve";
    }

    @Override
    protected Class<? extends Reducer> getReducerClass() {
        return MFP_DocumentBuilder_Reducer.class;
    }

    @Override
    protected int getReducerNumber() {
        return 1000;
    }

    @Override
    protected void setUp(JobConfig conf, FileSystem fs) throws IOException {
    }

    @Override
    protected void tearDown(JobConfig conf, FileSystem fs, RunningJob job)
            throws IOException {
    }

    public static void main(String[] args) throws Exception {
        // Job.buildXML(MFP_DocumentBuilder.class);

        new MFP_DocumentBuilder(args).submit();
    }

}
